<template>
  <div class="skills_menu">
    <el-button v-permission="['管理者']" type="primary" style="margin-bottom: 20px;" @click.native="linkToMange()">
      管理
    </el-button>
    <div class="wrapper">
      <el-row :gutter="30">
        <el-col
          v-for="(item, index) in menuList"
          :key="index"
          :span="6"
          @click.native="linkToList(item)"
        >
          <el-card shadow="hover">
            <img v-if="index==0" src="./img/icon_bianbie.png" alt="">
            <img v-if="index==1" src="./img/icon_tianqi.png" alt="">
            <img v-if="index==2" src="./img/icon_haiba.png" alt="">
            <img v-if="index==3" src="./img/icon_shuiyuan.png" alt="">
            <img v-if="index==4" src="./img/icon_quhuo.png" alt="">
            <img v-if="index==5" src="./img/icon_chongshou.png" alt="">
            <img v-if="index==6" src="./img/icon_yiliao.png" alt="">
            <p>{{ item }}</p>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { options } from '@/api/question'
export default {
  data() {
    return {
      menuList: []
    }
  },
  mounted() {
    this.getOptions()
  },
  methods: {
    async getOptions() {
      const res = await options()
      if (res.code == 200 && res.data) {
        this.menuList = res.data.auxiliary_knowledge_class
      }
    },
    linkToList(item) {
      this.$router.push({
        path: `/plantlib/skill/list/${item}`
      })
    },
    linkToMange() {
      this.$router.push({
        path: `/plantlib/skill/manage`
      })
    }
  }
}
</script>

<style lang="scss">
.skills_menu {
  .wrapper{
    min-width: 1000px;
    max-width: 1000px;
    .el-col {
      margin-bottom: 20px;
      .el-card{
        .el-card__body{
          height: 200px;
          cursor: pointer;
          text-align: center;
          font-size: 16px;
          font-weight: bold;
          img{
            margin-top: 30px;
          }
        }
      }
    }
  }
}
</style>
